import request from '@/utils/request'


export function loginByPassword(data) {
  return request({
    url: '/api/user/login',
    method: 'post',
    data
  })
}

/**
 * 验证码登录或者注册
 * @param {*} data 
 */
export function loginByPhoneCode(data) {
  return request({
    url: '/api/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/api/user/getUserInfo',
    method: 'get',
    params: {  }
  })
}

/**
 * 获取登录信息
 * @param {*} token 
 */
export function getInfoForCheckMenu(token) {
  return new Promise(
    function (resolve,reject){
      request({
        url: '/api/user/getUserInfo',
        method: 'get',
        params: {  }
      }).then(res=>{
          resolve(res);
      })
    }
  );
   
}


export function logout() {
  return new Promise((resolve,reject)=>{
    setTimeout(()=>{
      resolve('111');
    })
    
  })
  // return request({
  //   url: '/User/Logout',
  //   method: 'post'
  // })
}

/**
 * 获取验证码
 */
export function getPhoneCode(options) {
  return request({
    url: '/Direct/GetShortMsg',
    method: 'get',
    params: options
  })
  
}

/**
 * 获取用户列表
 * @param {*} options 
 */
export function getUserList(options) {
  return request({
    url: '/mg/User/GetList',
    method: 'get',
    params: options
  })
  
}

/**
 * 获取用户列表
 * @param {*} options 
 */
export function getUserInfo(options) {
  return request({
    url: '/mg/User/GetDetails',
    method: 'get',
    params: options
  })
  
}

/**
 * 重置账号密码
 * @param {*} options 
 */
export function resetAccountPassword(options){
  return request({
    url: '/mg/User/ResetPassword',
    method: 'get',
    params: options
  })
}
